//
//  systemMessageViewController.m
//  FastRunDemo
//
//  Created by 苟亚明 on 16/9/23.
//  Copyright © 2016年 苟亚明. All rights reserved.
//

#import "systemMessageViewController.h"
#import "systemMessageCell.h"
@interface systemMessageViewController ()

@end

@implementation systemMessageViewController
static NSString *const systemMessageCellId = @"systemMessageCellId";



- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    UIImage *image = [UIImage imageNamed:@"transparent-1"];
    [self.navigationController.navigationBar setBackgroundImage:image
                                                  forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:image];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"系统通知";
    [self.tableView registerNib:[UINib nibWithNibName:@"systemMessageCell" bundle:nil] forCellReuseIdentifier:systemMessageCellId];
    self.tableView.estimatedRowHeight = 66;
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"arrow_back" highImage:@"arrow_back" target:self action:@selector(leftBtnClick)];
}
- (void)leftBtnClick{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 7;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    systemMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:systemMessageCellId];
    // 获取1到30随机数
    int value = (arc4random() % 5) + 1;
    NSString *text = @"通知内容文字自适应";
    for (int i = 0; i < value; i++) {
        text = [text stringByAppendingString:text];
    }
    cell.lblContent.text = text;
    
    
    return cell;
}

@end
